<template>
  <div>
    <div class="mbx">
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item :to="{ path: '/index' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item :to="{ path: '/zhiyuanzheview' }"
          >志愿者详情</el-breadcrumb-item
        >
        <el-breadcrumb-item>志愿者应聘</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div id="app">
      <el-form ref="form" :model="volunteerform" label-width="80px">
        <el-form-item prop="title">
          <div class="tit">
            <span>招聘标题</span>
          </div>
          <el-input v-model="volunteerform.title"></el-input>
        </el-form-item>
        <el-form-item prop="position">
          <div class="tit">
            <span>职位</span>
          </div>
          <el-input v-model="volunteerform.position"></el-input>
        </el-form-item>
        <el-form-item prop="workPlace">
          <div class="tit">
            <span>工作地点</span>
          </div>
          <el-input v-model="volunteerform.workPlace"></el-input>
        </el-form-item>
        <el-form-item prop="workSalary">
          <div class="tit">
            <span>招娉要求</span>
          </div>
          <el-input v-model="volunteerform.workSalary"></el-input>
        </el-form-item>
        <el-form-item prop="lead">
          <div class="tit">
            <span>姓名</span>
          </div>
          <el-input v-model="volunteerform.lead"></el-input>
        </el-form-item>
        <el-form-item prop="contact">
          <div class="tit">
            <span>手机</span>
          </div>
          <el-input v-model="volunteerform.contact"></el-input>
        </el-form-item>
        <el-form-item>
          <el-input
            type="textarea"
            :rows="3"
            prop="workRequire"
            placeholder="请输入招娉原因"
            v-model="volunteerform.workRequire"
          >
          </el-input>
        </el-form-item>
        <div class="btn">
          <el-button type="primary" @click="getformlist"
            >提交志愿者表单</el-button
          >
        </div>
      </el-form>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      volunteerform: {},
    };
  },
  methods: {
    async getformlist() {
      let { data: res } = await this.$axios.post(
        "/volunteer/add",
        JSON.stringify(this.volunteerform),
        {
          headers: {
            "content-type": "application/json",
          },
        }
      );
      if (res.code != 200) return this.$message.error('添加失败');
      this.$message.success('添加成功');
    },
  },
};
</script>

<style lang="scss" scoped>
#app {
  height: 100%;
  border: 2px solid rgb(136,169,214);
  width: 50%;
  margin: 0 auto;
  box-shadow: 1px 1px 1px 1px rgba(136,169,214, 0.8);
  border-radius: 4px;
  .el-form {
    width: 100%;
    .el-form-item {
      // margin: 25px 20px;
      box-shadow: 1px 1px 1px 1px rgba(136,169,214, 0.4);
      font-size: 20px;
      .el-input {
        width: 400px !important;
      }

      .tit {
        width: 100px;
        display: inline-block;
      }
    }
  }
}
.mbx {
  margin: 0 auto;
  width: 50%;
  margin-top: 30px;
  margin-bottom: 20px;
}
.btn{
  display: flex;
  justify-content: center;
}
</style>